<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</meta>
<title>F().scaleTo演示</title>
<style type="text/css">
#imgbox{width:300px; height:300px;}
</style>
<script type="text/javascript" src="../../1st.js"></script>
</head>
<body>
<input value="/fw4/data/img/001.jpg"><button onclick="showImg(this.previousSibling.value,300,300)">显示图片</button>
<div id="imgbox"></div>

<script type="text/javascript">
function showImg(url, width, height){
	if(!url) return alert("图片不能为空");
	var img = new Image();
	img.onload = function(){
		var box = F("imgbox");
		var o = F.scale(img.width, img.height, width, height);
		o.u = img.src;
		box.html('<img src="$u" width="$w" height="$h" />'.mix(o));
	};
	img.src = url;
}
</script>
</body>
</html>